<?php

class ForumProfileBehavior extends CActiveRecordBehavior{

	public function beforeSave($event) {
		$owner = $this->getOwner();
		if (!empty($owner->username)) {
			$model = VAccount::model()->findByAttributes(array('worker_name'=>$owner->username));
			if (is_object($model)) {
				$owner->worker_id = $model->id;
				$owner->member_type = get_class($model);
				$owner->ucid = $model->ucid;
			}
		}
	}
}

?>